/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package parser.nodes;

import codegen.AbstractDescr;
import codegen.CodeGen;
import java.util.HashMap;

public abstract class Node {

    protected Node parent = null;
    static private String indent = "";

    public Node parent() {
        return this.parent;
    }

    public void setParent(Node p) {
        this.parent = p;
    }

    public abstract void print();
    //public void abstractPrint() { p("??? " + this.getClass().getName().replaceAll("[^\\.]*\\.", ""));}

    public abstract void abstractPrint();

    public void compile(CodeGen c) throws CompileError {
        c.outstr("??? " + this.getClass().getName().replaceAll("[^\\.]*\\.", ""));
    }
	//public abstract void compile(CodeGen c) throws CompileError;

    protected void indent() {
        indent += "    ";
    }

    protected void unindent() {
        indent = indent.substring(4);
    }

    public static void p(Object o) {
        System.out.println(indent + o);
    }
    
    public AbstractDescr getDescriptor(CodeGen c) throws CompileError {
        return null;
    }
    
    protected void cerr(String what) throws CompileError {
        throw new CompileError(what);
    }
}
